home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!chi-il9-25
- From: stefmit@ix.netcom.com
- Newsgroups: comp.lang.c++
- Subject: [Q] Simple question about constructors
- Date: 2 Mar 1996 19:26:26 GMT
- Organization: Netcom
- Message-ID: <4ha7d2$quc@cloner4.netcom.com>
- NNTP-Posting-Host: chi-il9-25.ix.netcom.com
- X-NETCOM-Date: Sat Mar 02 11:26:26 AM PST 1996
- X-Newsreader: News Xpress Version 1.0 Beta #4
-
- Trying to work/learn C++ from an old book, I got to a point where my
- understanding stops: picking a sample constructor from another much
- newer source, I came across a syntax in the form:
- class_name :: class_name (arguments) : data_member1 (argument1), data_member2
- (argument2) {}
- The portion I don't know the meaning of (though I assume is kind of
- intialization list, that would've appeared otherwise within {}, as far as I
- learned from my book), is the portion after ":".
- I would kindly request some elaboration on this, especially concerning a
- statement in the source where I found this, similar to: "this is the only way
- the initialization can be done in some cases (!!!)". Does this mean I am not
- always able to define a constructor the way I've learned so far (in its {}
- body)?
- Thanks a lot for any suggestions, and please refrain from sending me to RTFM.
- I have a manual I am using, and doesn't have this syntax. Neither I found it
- in the FAQ for this group.
-